<template>
  <view class="content">
    <text style="font-size: 30px;">子组件B</text>
    <view class="b-box">
      <text>CompA组件传进来的值：</text>
      <text class="intent-text-box">{{ result }}</text>
    </view>
    <view class="b-box" style="margin: 10rpx;">
      <text>回传值：</text>
      <!-- 监听input事件，实时传值 -->
      <input type="text" v-model="callbackValue" style="color: black;" @input="sendToParent" />
      <!-- 按钮可保留，也可改为“确认回传”提示 -->
      <button @click="sendToParent">回传</button>
    </view>
  </view>
</template>

<script>
export default {
  props: ['result'],
  data() {
    return {
      callbackValue: ''
    }
  },
  methods: {
    sendToParent() {
      this.$emit('callBackFun', this.callbackValue);
    }
  }
}
</script>